import { UserModel } from "../../account_server/model/UserModel";
import { RoomConfig } from "../../src/config/RoomConfig";
import DateUtil from "../../src/engine/utils/DateUtil";
import { JhaoProto } from "../../src/lib/net/protobuf/jhaoproto";
import { RoomModel } from "./RoomModel";

export class RoomPlayer {

    public userid: number;
    public nick_name: string;
    public headimg: string;
    public invite: number
    public score: number = 0
    public chair: number = 0;
    public ready: boolean = false;
    public joinTime: number = 0
    public sex: number = 0
    public location: string = ""
    public matchTurn: number = 0
    public max_score: number = 0
    public chargeEndTime: number = 0 //充值限时
    public isMachine: boolean = false
    public isOnline: boolean = true

    public zimo: number = 0      //自摸次数
    public jiepao: number = 0    ////接炮次数
    public dianpao: number = 0   //点炮次数
    public gangTimes: number = 0 //摸豆次数
    public jiTimes: number = 0//摸鸡次数


    public static createPlayerByUser(user: UserModel, room: JhaoProto.IRoomModel):JhaoProto.IRoomPlayer {
        let player: JhaoProto.IRoomPlayer = {
            userid:user.userid,
            nickName:user.nick_name,
            headimgurl:user.headimg,
            sex:user.sex,
            score:0,
            isReady:false,
            isOnline:false,
        }
        return player
    }


    public clone() {
        // let player: RoomPlayer = new RoomPlayer()
        // player.userid = this.userid
        // player.nick_name = this.nick_name
        // player.headimg = this.headimg
        // player.invite = this.invite
        // player.score = this.score
        // player.chair = this.chair
        // player.ready = this.ready
        // player.joinTime = this.joinTime
        // player.sex = this.sex;
        // player.location = this.location
        // player.matchTurn = this.matchTurn
        // player.max_score = this.max_score
        // player.chargeEndTime = this.chargeEndTime
        // player.isMachine = this.isMachine
        // player.isOnline = this.isOnline
        // player.zimo = this.zimo
        // player.jiepao = this.jiepao
        // player.dianpao = this.dianpao
        // player.gangTimes = this.gangTimes
        // player.jiTimes = this.jiTimes
        // return player
    }
}